<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ThreadPosts.ascx.cs" Inherits="forums_controls_threads_ThreadPosts" %>
<asp:Repeater runat="server" ID="gridPosts">
    <ItemTemplate>
        <a name="<%# Eval("ID") %>" />
        <table width="100%" cellpadding="3" cellspacing="5">
            <tr>
                <td class="post_left">
                    <asp:HyperLink runat="server" ID="lnkProfile"
                        Text='<%# Helpers.StringHelper.SafeFormat(Eval("User.Username")) %>'
                        NavigateUrl='<%# Helpers.StringHelper.SafeFormat("~/forums/profile.aspx?u={0}", Eval("User.ID")) %>' />
                    <%# GetUserTitle(Eval("User") as DAL.User) %>
                    <%# GetAvatar(Eval("User") as DAL.User) %>
                    <%# Helpers.StringHelper.SafeFormat("<p>Posts: {0}</p>", Eval("User.TotalPosts")) %>
                    <%# Helpers.StringHelper.FormatIfExists("<p>Location: {0}</p>", Eval("User.Location")) %>
                    <p>
                    <%# Convert.ToDateTime(Eval("DatePosted")).ToString("yyyy-MMM-dd hh:mm tt") %>
                    </p>
                </td>
                <td class="post_right">
                    <p>
                        <%# Helpers.StringHelper.SafeFormat("<a href=\"thread.aspx?p={0}#{0}\">#{0}</a>", Eval("ID")) %>
                        <%# Helpers.StringHelper.FormatIfExists("<b>{0}</b>", Eval("Subject")) %>
                    </p>
                    <%# DAL.YCodes.Format(Eval("Content") as string) %>
                    <%# GetSignature(Eval("User") as DAL.User) %>
                    <table width="100%">
                        <tr>
                            <td>
                                <asp:HyperLink runat="server" ID="lnkEdit"
                                    Text="Edit"
                                    NavigateUrl='<%# Helpers.StringHelper.SafeFormat("~/forums/editpost.aspx?p={0}", Eval("ID")) %>'
                                    Visible='<%# CanEditPost(Eval("User") as DAL.User) %>' />
                            </td>
                            <td align="right">
                                <asp:HyperLink runat="server" ID="lnkQuote"
                                    Text="Quote"
                                    NavigateUrl='<%# Helpers.StringHelper.SafeFormat("~/forums/newpost.aspx?q={0}", Eval("ID")) %>'
                                    Visible='<%# IsUserLoggedIn %>'/>
                                <asp:HyperLink runat="server" ID="lnkReply"
                                    Text="Reply"
                                    NavigateUrl='<%# Helpers.StringHelper.SafeFormat("~/forums/newpost.aspx?p={0}", Eval("ID")) %>'
                                    Visible='<%# IsUserLoggedIn %>'/>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </ItemTemplate>
</asp:Repeater>